package cn.matezk.lianlian.model;

import lombok.Data;

import java.util.Date;

@Data
public class NotifyRecord {
    public static String createLockKey(String bizId) {
        return "lock.notify.".concat(bizId);
    }

    public static final Integer STATUS_WAIT = -1;
    public static final Integer STATUS_CONFIRM = 0;
    public static final Integer STATUS_SUCCESS = 1;
    public static final Integer STATUS_FAILED = 2;
    public static final Integer STATUS_CANCEL = 10;

    public static final int ERROR_CODE_LEN = 50;
    public static final int ERROR_MSG_LEN = 300;

    private Long id;
    private String eventId;
    private String eventCode;
    private String deviceId;
    private String templateCode;
    private String bizId;
    private String method;
    private String toUser;
    private String params;
    private String content;
    private Integer status;
    private String errorCode;
    private String errorMsg;
    private Date notifyTime;

    public String getProductId() {
        return deviceId.split("/")[0];
    }

    public String getDeviceName() {
        return deviceId.split("/")[1];
    }
}
